function List() {
    this.listSize = 0;
    this.pos = 0;
    this.dataStore = [];
}
// methods
List.prototype.clear = function() {
    delete this.dataStore;
    this.dataStore.length = 0;
    this.listSize = this.pos = 0;
}
List.prototype.find = function(element) {
    for(var i = 0; i < this.dataStore; i++) {
        if(this.dataStore[i] == element) {
            return i;
        }
    }
    return -1;
}
List.prototype.toString = function() {
    return this.dataStore;
}
List.prototype.insert = function(element, after) {
    var insertPos = this.find(element);
    if(insertPos > -1) {
        this.dataStore.splice(insertPos+1, 0, element);
        this,listSize++;
        return true;
    }
    return false;
}
List.prototype.append = function(element) {
    this.dataStore[this.listSize++] = element;
}
List.prototype.remove = function(element) {
    var pos = this.find(element);
    if(pos > -1) {
        this.dataStore.splice(i, 0);
        this.listSize--;
        return true;
    }
    return false;
    
}
List.prototype.front = function() {
    this.pos = 0;
}
List.prototype.end = function() {
    this.pos = this.listSize - 1;
}
List.prototype.prev = function() {
    if(this.pos > 0) {
        this.pos--;
    }
}
List.prototype.next = function() {
    if(this.pos < this.listSize - 1) {
        this.pos++;
    }
}
List.prototype.currPos = function() {
    return this.pos;
}
List.prototype.moveTo = function(position) {
    this.pos = position;
}
List.prototype.getElement = function() {
    return this.dataStore[this.pos];
}
List.prototype.getLength = function() {
    return this.dataStore.length;
}
List.prototype.contains = function(element) {
    var pos = this.find(element);
    if(pos > -1) {
        return true
    }
    return false;
}
List.prototype.moreThan = function(element) {
    var isMoreThan = true;
    for(var i = 0; i < this.listSize; i++) {
        if(element <= this.dataStore[i]) {
            isMoreThan = false;
        }
    }
    if(isMoreThan) {
        this.append(element);
    }
}

var names = new List();
names.append(1);
names.append(2);
names.append(4);
names.append(5);
console.log('names are:', names.toString());
names.moreThan(5);
console.log('names are:', names.toString());
names.moreThan('a');
console.log('names are:', names.toString());
